unit scDict;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, DBGridEh, ComCtrls, ToolWin, sToolBar, DB,
  DBActns, ActnList;

type
  TfmDict = class(TForm)
    tbCode: TsToolBar;
    btnFirstSep: TToolButton;
    btnAddCode: TToolButton;
    btnCopy: TToolButton;
    btnDeleteCode: TToolButton;
    dbgDict: TDBGridEh;
    btnSave: TToolButton;
    btnSep: TToolButton;
    dsDict: TDataSource;
    actlstDict: TActionList;
    actInsert: TDataSetInsert;
    actDelete: TDataSetDelete;
    actCopy: TDataSetEdit;
    actPost: TDataSetPost;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure dbgDictTitleBtnClick(Sender: TObject; ACol: Integer;
      Column: TColumnEh);
    procedure btnSaveClick(Sender: TObject);
    procedure btnAddCodeClick(Sender: TObject);
    procedure btnCopyClick(Sender: TObject);
    procedure btnDeleteCodeClick(Sender: TObject);
    procedure ToolButton1Click(Sender: TObject);
  private

  public
    { Public declarations }
  end;

implementation

uses dbMyUtils;

{$R *.dfm}

procedure TfmDict.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action := caFree;
end;

procedure TfmDict.dbgDictTitleBtnClick(Sender: TObject; ACol: Integer;
  Column: TColumnEh);
begin
  SortGrid(Column);
end;

procedure TfmDict.btnSaveClick(Sender: TObject);
begin
  PostChanges(dsDict.DataSet);
end;

procedure TfmDict.btnAddCodeClick(Sender: TObject);
begin
  dsDict.DataSet.Append;
end;

procedure TfmDict.btnCopyClick(Sender: TObject);
begin
  CopyDataSet(dsDict.DataSet);
end;

procedure TfmDict.btnDeleteCodeClick(Sender: TObject);
begin
  DeleteCurR(dsDict.DataSet);
end;

procedure TfmDict.ToolButton1Click(Sender: TObject);
begin
  RefreshQ(dsDict.DataSet);
end;

end.
